package com.heu.blood.security.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.heu.blood.common.utils.PageUtils;
import com.heu.blood.common.utils.Query;
import org.apache.logging.log4j.util.Strings;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.heu.blood.security.dao.BloodRightDao;
import com.heu.blood.security.entity.BloodRightEntity;
import com.heu.blood.security.service.BloodRightService;


@Service("bloodRightService")
public class BloodRightServiceImpl extends ServiceImpl<BloodRightDao, BloodRightEntity> implements BloodRightService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        LambdaQueryWrapper<BloodRightEntity> bloodRightEntityQueryWrapper = new LambdaQueryWrapper<>();
        if(Strings.isNotBlank((String)params.get("rightDes"))){
            bloodRightEntityQueryWrapper.like(Strings.isNotBlank((String)params.get("rightDes")),
                    BloodRightEntity::getRightDes,(String)params.get("rightDes"));
        }
        IPage<BloodRightEntity> page = this.page(
                new Query<BloodRightEntity>().getPage(params),
                bloodRightEntityQueryWrapper
        );

        return new PageUtils(page);
    }

}